﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace FMSpaceShooter.Util
{
    static class Tools
    {
        public static Vector2 GetTextureVector(Texture2D texture)
        {
            return new Vector2(texture.Width, texture.Height);
        }

        public static Vector2 GetBoxOrigin(Vector2 box)
        {
            return box / 2;
        }

        public static Vector2 AngleToVector(float angle)
        {
            angle -= (float)(Math.PI /2);
            // used from http://stackoverflow.com/questions/2276855/xna-2d-vector-angles-whats-the-correct-way-to-calculate
            return new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
        }

        public static float VectorToAngle(Vector2 vector)
        {
            // used from http://stackoverflow.com/questions/2276855/xna-2d-vector-angles-whats-the-correct-way-to-calculate
            return (float)Math.Atan2(vector.Y, vector.X) + (float)(Math.PI / 2);
        }
    }
}
